package cn.quevo.core.exception;

import cn.quevo.core.entity.ResultEntity;
import cn.quevo.core.enums.EnumsInterface;
import cn.quevo.core.lang.StringUtils;
import lombok.Getter;
import lombok.Setter;

/**
 * 参数检验异常
 *
 * @author July july_sky@foxmail.com
 * @date 2018-03-09 14:00:45
 * @Copyright ©2015-2035 湘豫(北京)科技有限公司. All Rights Reserved.
 * @version 1.0
 * @param null
 * @return
 */
@Getter
@Setter
public class CheckParamsException extends CustomException {

    /**
     * 
     */
    private static final long serialVersionUID = 6414303885328955361L;
    /** 目标字段，用于固定错误显示位置 */
    private String target;

    public CheckParamsException(String msg) {
        super(msg);
    }

    public CheckParamsException(EnumsInterface enums) {
        super(enums);
    }

    public CheckParamsException(Integer status, String msg, Throwable cause) {
        super(status, msg, cause);
    }

    public CheckParamsException(Integer status, String msg) {
        super(status, msg);
    }

    public CheckParamsException(ResultEntity result) {
        super(result);
    }

    public CheckParamsException(Integer status, String msg, String target) {
        super(status, msg);
        this.target = target;
    }

    @Override
    public String toString() {
        return StringUtils.isBlank(target) ? super.toString() : super.toString() + target;
    }
}
